using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Decisions.HL7.Message;
using DecisionsFramework;

namespace Decisions.HL7.Message
{
    public class TimeSelectionCriteriaParameterClassCodesAttribute:RuleAttribute
    {
        private Dictionary<HL7Version, string[]> validVersionCodes = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, string[]> validVersionDescriptions = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, HL7TableType> tableVersionTypes = new Dictionary<HL7Version, HL7TableType>();

        public TimeSelectionCriteriaParameterClassCodesAttribute()
        {
            // init the values for table version types
						tableVersionTypes[HL7Version.v23] = HL7TableType.User;
						tableVersionTypes[HL7Version.v231] = HL7TableType.User;
						tableVersionTypes[HL7Version.v24] = HL7TableType.User;
						tableVersionTypes[HL7Version.v25] = HL7TableType.User;
						tableVersionTypes[HL7Version.v251] = HL7TableType.User;
						tableVersionTypes[HL7Version.v26] = HL7TableType.User;
						tableVersionTypes[HL7Version.v27] = HL7TableType.User;
			
            
			// init the values for version codes
						validVersionCodes[HL7Version.v23] = new string[]{"FRI","MON","PREFEND","PREFSTART","SAT","SUN","THU","TUE","WED"};
						validVersionCodes[HL7Version.v231] = new string[]{"PREFSTART","PREFEND","MON","TUE","WED","THU","FRI","SAT","SUN"};
						validVersionCodes[HL7Version.v24] = new string[]{"Prefstart","Prefend","Mon","Tue","Wed","Thu","Fri","Sat","Sun"};
						validVersionCodes[HL7Version.v25] = new string[]{"Prefstart","Prefend","Mon","Tue","Wed","Thu","Fri","Sat","Sun"};
						validVersionCodes[HL7Version.v251] = new string[]{"Prefstart","Prefend","Mon","Tue","Wed","Thu","Fri","Sat","Sun"};
						validVersionCodes[HL7Version.v26] = new string[]{"Prefstart","Prefend","Mon","Tue","Wed","Thu","Fri","Sat","Sun"};
						validVersionCodes[HL7Version.v27] = new string[]{"Prefstart","Prefend","Mon","Tue","Wed","Thu","Fri","Sat","Sun"};
			
			// init the values for version descriptions
						validVersionDescriptions[HL7Version.v23] = new string[]{"An indicator that Friday is or is not preferred for the day on which the appointment will occur.  OK = Preferred appointment dayNO = Day is not preferred","An indicator that Monday is or is not preferred for the day on which the appointment will occur.  OK = Preferred appointment dayNO = Day is not preferred","The preferred start time for the appointment request, service or resource.  Any legal time specification in the format HHMM, using 24-hour clock notation","The preferred start time for the appointment request, service or resource.   Any legal time specification in the format HHMM, using 24-hour clock notation","An indicator that Saturday is or is not preferred for the day on which the appointment will occur.  OK = Preferred appointment dayNO = Day is not preferred","An indicator that Sunday is or is not preferred for the day on which the appointment will occur.  OK = Preferred appointment dayNO = Day is not preferred","An indicator that Thursday is or is not preferred for the day on which the appointment will occur.  OK = Preferred appointment dayNO = Day is not preferred","An indicator that Tuesday is or is not preferred for the day on which the appointment will occur.  OK = Preferred appointment dayNO = Day is not preferred","An indicator that Wednesday is or is not preferred for the day on which the appointment will occur. OK = Preferred appointment dayNO = Day is not preferred"};
						validVersionDescriptions[HL7Version.v231] = new string[]{"The preferred start time for the appointment request, service or resource.   Any legal time specification in the format HHMM, using 24-hour clock notation","The preferred end time for the appointment request, service or resource.  Any legal time specification in the format HHMM, using 24-hour clock notation","An indicator that Monday is or is not preferred for the day on which the appointment will occur.  OK = Preferred appointment day NO = Day is not preferred","An indicator that Tuesday is or is not preferred for the day on which the appointment will occur.  OK = Preferred appointment day NO = Day is not preferred","An indicator that Wednesday is or is not preferred for the day on which the appointment will occur. OK = Preferred appointment day NO = Day is not preferred","An indicator that Thursday is or is not preferred for the day on which the appointment will occur.  OK = Preferred appointment day NO = Day is not preferred","An indicator that Friday is or is not preferred for the day on which the appointment will occur.  OK =  Preferred appointment day NO = Day is not preferred","An indicator that Saturday is or is not preferred for the day on which the appointment will occur.  OK =  Preferred appointment day NO = Day is not preferred","An indicator that Sunday is or is not preferred for the day on which the appointment will occur.  OK = Preferred appointment day NO = Day is not preferred"};
						validVersionDescriptions[HL7Version.v24] = new string[]{"The preferred start time for the appointment request, service or resource.   Any legal time specification in the format HHMM, using 24-hour clock notation","The preferred end time for the appointment request, service or resource.  Any legal time specification in the format HHMM, using 24-hour clock notation","An indicator that Monday is or is not preferred for the day on which the appointment will occur.  OK = Preferred appointment day; NO = Day is not preferred","An indicator that Tuesday is or is not preferred for the day on which the appointment will occur.  OK = Preferred appointment day; NO = Day is not preferred","An indicator that Wednesday is or is not preferred for the day on which the appointment will occur. OK = Preferred appointment day; NO = Day is not preferred","An indicator that Thursday is or is not preferred for the day on which the appointment will occur.  OK = Preferred appointment day; NO = Day is not preferred","An indicator that Friday is or is not preferred for the day on which the appointment will occur.  OK = Preferred appointment day; NO = Day is not preferred","An indicator that Saturday is or is not preferred for the day on which the appointment will occur.  OK = Preferred appointment day; NO = Day is not preferred","An indicator that Sunday is or is not preferred for the day on which the appointment will occur.  OK = Preferred appointment day; NO = Day is not preferred"};
						validVersionDescriptions[HL7Version.v25] = new string[]{"An indicator that there is a preferred start time for the appointment request, service or resource.","An indicator that there is a preferred end time for the appointment request, service or resource.","An indicator that Monday is or is not preferred for the day on which the appointment will occur.","An indicator that Tuesday is or is not preferred for the day on which the appointment will occur.","An indicator that Wednesday is or is not preferred for the day on which the appointment will occur.","An indicator that Thursday is or is not preferred for the day on which the appointment will occur.","An indicator that Friday is or is not preferred for the day on which the appointment will occur.","An indicator that Saturday is or is not preferred for the day on which the appointment will occur.","An indicator that Sunday is or is not preferred for the day on which the appointment will occur."};
						validVersionDescriptions[HL7Version.v251] = new string[]{"An indicator that there is a preferred start time for the appointment request, service or resource.","An indicator that there is a preferred end time for the appointment request, service or resource.","An indicator that Monday is or is not preferred for the day on which the appointment will occur.","An indicator that Tuesday is or is not preferred for the day on which the appointment will occur.","An indicator that Wednesday is or is not preferred for the day on which the appointment will occur.","An indicator that Thursday is or is not preferred for the day on which the appointment will occur.","An indicator that Friday is or is not preferred for the day on which the appointment will occur.","An indicator that Saturday is or is not preferred for the day on which the appointment will occur.","An indicator that Sunday is or is not preferred for the day on which the appointment will occur."};
						validVersionDescriptions[HL7Version.v26] = new string[]{"An indicator that there is a preferred start time for the appointment request, service or resource.","An indicator that there is a preferred end time for the appointment request, service or resource.","An indicator that Monday is or is not preferred for the day on which the appointment will occur.","An indicator that Tuesday is or is not preferred for the day on which the appointment will occur.","An indicator that Wednesday is or is not preferred for the day on which the appointment will occur.","An indicator that Thursday is or is not preferred for the day on which the appointment will occur.","An indicator that Friday is or is not preferred for the day on which the appointment will occur.","An indicator that Saturday is or is not preferred for the day on which the appointment will occur.","An indicator that Sunday is or is not preferred for the day on which the appointment will occur."};
						validVersionDescriptions[HL7Version.v27] = new string[]{"An indicator that there is a preferred start time for the appointment request, service or resource.","An indicator that there is a preferred end time for the appointment request, service or resource.","An indicator that Monday is or is not preferred for the day on which the appointment will occur.","An indicator that Tuesday is or is not preferred for the day on which the appointment will occur.","An indicator that Wednesday is or is not preferred for the day on which the appointment will occur.","An indicator that Thursday is or is not preferred for the day on which the appointment will occur.","An indicator that Friday is or is not preferred for the day on which the appointment will occur.","An indicator that Saturday is or is not preferred for the day on which the appointment will occur.","An indicator that Sunday is or is not preferred for the day on which the appointment will occur."};
			            

        }

        
        public override ValidationIssue[] RunRule(string name, object owningObject, object value)
        {
            //todo: check if the value is valid in the current version
            //if the value is not valid in the current version, add it as a validation issue


            return new ValidationIssue[0];
        }
    }
}
